package org.internna.expensetracker.model.support;

public class NameValuePair<E extends Comparable<E>, T> implements Comparable<NameValuePair<E, T>> {

	private E key;
	private T value;

	public NameValuePair(E key, T value) {
		this.key = key;
		this.value = value;
	}

	public final E getKey() {
		return key;
	}

	public final void setKey(E key) {
		this.key = key;
	}

	public final T getValue() {
		return value;
	}

	public final void setValue(T value) {
		this.value = value;
	}

	@Override public int compareTo(NameValuePair<E, T> other) {
		return other == null ? -1 : key == null ? 1 : key.compareTo(other.key);
	}

	@Override public String toString() {
		return "[key: " + key + ", value: " + value + "]";
	}

}
